package com.scf.fruit.business.commodity.controller;

import com.scf.fruit.business.commodity.bo.CommodityBo;
import com.scf.fruit.business.commodity.po.CommodityReq;
import com.scf.fruit.business.hospital.po.request.HospitalReq;
import com.scf.fruit.util.DataTablesRes;
import com.scf.fruit.util.ResponseVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @author : 孙超飞
 * @title :
 * @description :
 * @copyright :
 * @date : 2018-05-21 18:06
 */
@RestController
@RequestMapping(value = "/commodity",produces = "application/json")
public class CommodityController {
    @Resource
    private CommodityBo commodityBo;

    @RequestMapping(value = "/queryCommodityByPage",method = RequestMethod.GET)
    public ResponseVo queryCommodityByPage(@RequestParam("pageNum")Integer pageNum,@RequestParam("length") Integer length){
        return commodityBo.queryCommodityByPage(pageNum,length);
    }

    @RequestMapping(value = "/insertCommodity",method = RequestMethod.POST)
    public ResponseVo insertCommodity(@RequestBody CommodityReq req){
        return commodityBo.insertCommodity(req);
    }


    @RequestMapping(value = "/updateCommodity",method = RequestMethod.POST)
    public ResponseVo updateCommodity(@RequestBody CommodityReq req){
        return commodityBo.updateCommodity(req);
    }


    @RequestMapping(value = "/deleteCommodity",method = RequestMethod.GET)
    public ResponseVo deleteCommodity(@RequestParam("id")Long id){
        return commodityBo.deleteCommodity(id);
    }

}
